package com.kvest.map.mapview.engine.network;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.InputStream;
import java.net.URL;

/**
 * Created with IntelliJ IDEA.
 * User: r.belokon
 * Date: 22.04.13
 * Time: 17:41
 * To change this template use File | Settings | File Templates.
 */
public abstract class ImageLoader {
    private  static BitmapFactory.Options opt = new BitmapFactory.Options();
    static {
        opt.inPreferredConfig = Bitmap.Config.RGB_565;
    }

    public static Bitmap loadImage(String url)
    {
        try
        {
            InputStream is = (InputStream) new URL(url).getContent();
            Bitmap result = BitmapFactory.decodeStream(is, null, opt);
            return result;
        }
        catch (Exception e)
        {
            return null;
        }
    }
}
